package jiejie.jianzhioffer;

public class offer14_1 {
    public static void main(String[] args) {

    }

    /**
     * 剪绳子1
     * @param n
     * @return
     */
    public int cuttingRope(int n) {
        int[] dp = new int[n+7];
        dp[0]=0;
        dp[1]=1;
        dp[2]=1;
        dp[3]=2;
        dp[4]=4;
        dp[5]=6;
        dp[6]=9;
        for(int i=7; i<=n; i++){
            dp[i]=dp[i-3]*3;
        }
        return dp[n];
    }
}